jQuery(function($){
	$("input:reset, input:submit, input:button").button();	
});

function showMDialog(surl, sFeatures, reload) {
	if (surl.substr(surl.length - 7) != ".action") {
		surl += "&time=" + new Date();
	}
	if ($.browser.msie) {
		showModalDialog(surl, window, "status:no;center:yes;" + sFeatures);
		if (reload) {
			window.location.reload();
		} else {
			gridReload();
		}
	} else {
		window.open(surl, "status:no;center:yes;" + sFeatures, "modal=yes");
	}
}

/*
function resetAll() {
	var inputs = $(".search-condition").find("input");
	$.each(inputs, function() {
		$(this).attr("value", "");
		$(this).attr("checked", "");
	});
	gridReload();
}
*/
/**
 * target:select标签的ID setup：要显示多少年份比如10年
 * ck:返回true则默认显示“请选择”，false则默认显示一个年份比如2010
 */
function selectYear(target, setup, ck) {
	var targetValue = $('#' + target).val();
	// alert(targetValue);
	var myDate = new Date();
	var start = myDate.getFullYear();
	// alert(start);
	if (targetValue == null) {
		if (ck) {
			$('#' + target).append(
					$("<option value='' selected='true'>" + '--请选择--'
							+ "</option>"));
		}
		for (i = start; i > start - setup; i--) {

			$('#' + target).append(
					$("<option value='" + i + "'>" + i + "</option>"));
		}

	}
}

function currectYear(target) {
	var targetyear = $('#' + target).val();
	var tt;
	// alert("aa");
	// alert(targetyear);
	// currect in the select year
	$('select option').each( function(i) {
		if ($(this).val() == targetyear) {
			// $(this).attr("selected","selected");
			tt = $(this);
			return false;
		}
	});
	if (tt != null) {
		setTimeout( function() {
			tt.attr("selected", true);
		}, 1);
	}

}


/*
 * 日期格式化函数
 * 
 * Date.prototype.format = function(format) { var o = { "M+" :
 * this.getMonth()+1, "d+" : this.getDate(), "h+" : this.getHours(), "m+" :
 * this.getMinutes(), "s+" : this.getSeconds(), "q+" :
 * Math.floor((this.getMonth()+3)/3), "S" : this.getMilliseconds() };
 * if(/(y+)/.test(format)) {
 * format=format.replace(RegExp.$1,(this.getFullYear()+"").substr(4 -
 * RegExp.$1.length)); }; for(var k in o) { if(new RegExp("("+ k
 * +")").test(format)) { format = format.replace(RegExp.$1,RegExp.$1.length==1 ?
 * o[k] : ("00"+ o[k]).substr((""+ o[k]).length)); }; }; return format; };
 */

